package com.cityfood.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

import com.cityfood.common.pojo.CityFoodResult;
import com.cityfood.pojo.CfShop;
import com.cityfood.service.ShopService;

@Controller
@RequestMapping("/shop")
public class ShopController {
	
	@Autowired
	private ShopService shopService;
	
	@RequestMapping("/save")
	public CityFoodResult addShop(CfShop shop){
		shop.setName("123");
		shop.setAddress("深圳");
		shop.setMetroAddress("深圳北站");
		shop.setTel("15972784546");
		shop.setCoord("广东");
		CityFoodResult cityFoodResult = new CityFoodResult();
		int i = shopService.saveShop(shop);
		if (i>0) {
			cityFoodResult.setCode(200);
			cityFoodResult.setMsg("添加成功");
			cityFoodResult.setData(i);
		}else{
			cityFoodResult.setCode(400);
			cityFoodResult.setMsg("添加失败");
			cityFoodResult.setData(-1);
		}
		return cityFoodResult; 
	}

}
